<?php
/*========================================= JooSam =========================================/
/																							/
/	Extention:		JooSam																	/
/	Created by:		ScriptPlanet.eu															/
/	Site:			http://www.scriptplanet.eu												/
/	Email:			support@scriptplanet.eu													/
/	Support:		http://www.scriptplanet.eu/support										/
/	Copyright:		2011 (c) ScriptPlanet.eu												/
/	License:		CC BY-NC-ND 3.0 ~ http://creativecommons.org/licenses/by-nc-nd/3.0/		/
/	File Version:	0001																	/
/																							/
/========================================== JooSam ========================================*/
// Joomla Security
defined('_JEXEC') or die;
class modJoosamShoutcast{

	public static function settings($params){

		## Global
		$download = 'modules/mod_joosam_shoutcast/download.php';
		$picture = 'media/com_joosam/shoutcast/';
		$NameActive = $params->get('showname');
		$Name = $params->get('samname');
		if($Name == ''){
			$Name = 'radiostation';
		}

		$config = array(
					## Winamp
					'Winamp' =>		array(
										'act'	=> $params->get('wampactive'),
										'url'	=> $params->get('wampip'),
										'port'	=> $params->get('wampport'),
										'path'	=> $params->get('wampsub'),
										'form'	=> 'PLS',
										'file'	=> $Name,
										'image'	=> $picture.'winamp.png',
										'alt'	=> JText::_('MOD_JOOSAM_SHOUTCAST_WINAMP_IMG_ALT')),
					## Media Player
					'Mplayer' =>	array(
										'act'	=> $params->get('wmpactive'),
										'url'	=> $params->get('wmpip'),
										'port'	=> $params->get('wmpport'),
										'path'	=> $params->get('wmpsub'),
										'form'	=> 'ASX',
										'file'	=> $Name,
										'image'	=> $picture.'wmplayer.png',
										'alt'	=> JText::_('MOD_JOOSAM_SHOUTCAST_MPLAYER_IMG_ALT')),
					## Media Player
					'iTunes' =>		array(
										'act'	=> $params->get('itunactive'),
										'url'	=> $params->get('itunip'),
										'port'	=> $params->get('itunport'),
										'path'	=> $params->get('itunsub'),
										'form'	=> 'QTL',
										'file'	=> $Name,
										'image'	=> $picture.'itunes.png',
										'alt'	=> JText::_('MOD_JOOSAM_SHOUTCAST_ITUNES_IMG_ALT')),

					## Real Player
					'Rplayer' =>	array(
										'act'	=> $params->get('replactive'),
										'url'	=> $params->get('replip'),
										'port'	=> $params->get('replport'),
										'path'	=> $params->get('replsub'),
										'form'	=> 'RAM',
										'file'	=> $Name,
										'image'	=> $picture.'realplayer.png',
										'alt'	=> JText::_('MOD_JOOSAM_SHOUTCAST_RPLAYER_IMG_ALT')),

					## Mobile (XDA)
					'Mobile' =>		array(
										'act'	=> $params->get('xdaactive'),
										'url'	=> $params->get('xdaip'),
										'port'	=> $params->get('xdaport'),
										'path'	=> $params->get('xdasub'),
										'form'	=> 'PLS',
										'file'	=> $Name,
										'image'	=> $picture.'iPhone.png',
										'alt'	=> JText::_('MOD_JOOSAM_SHOUTCAST_MOBILE_IMG_ALT'))
		);
		
		## Build Output
		$output = '<div id="station" style="margin:0 auto 10px auto;text-align:center;">';
		if($NameActive == 1){
			$output .= $Name;
		}
		$output .= '</div>';
		$output .= '<div id="linkbuttons" style="margin:auto;text-align:center;">';
		
		## Build Link
		foreach($config as $dev){
			$active = $dev['act'];
			$host = $dev['url'];
			$port = $dev['port'];
			$path = $dev['path'];
			$file = $dev['file'];
			$form = $dev['form'];
			$image = $dev['image'];
			$alt = $dev['alt'];
			if($active == 1){
				$output .= '<a href="'.$download.'?host='.$host.'&file='.$file.'&port='.$port.'&path='.$path.'&form='.$form.' ">
								<img src="'.$image.'" border=0 title="'.$alt.'"	/>
							</a>';
			}
		}

		$output .= '</div>';
		return $output;
	}
}
?>